﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{
	
	public $images;
	public $name;
	public $addtime;
	public $content;
	public $talkid;
	public $reply;
	
	function __construct($images,$name,$addtime,$content,$talkid,$reply)
	{
		
		$this->images      = $images;
		$this->name      = $name;
		$this->addtime      = $addtime;
		$this->content      = $content;
		$this->talkid      = $talkid;
		$this->reply      = $reply;
	
	}
}

if($_REQUEST['page']!="")
{
$de=$_REQUEST['page']*$_REQUEST['pagesize'];
$size=$_REQUEST['pagesize'];
}

else
{
$de=0;
$size=5;
}



   
   $rert31=mysql_query("select * from talks where cid='".$_REQUEST['cid']."'  order by id desc limit $de,$size ");
  $prize = array();
 while($rowf=mysql_fetch_array($rert31)){

  
     $rert32=mysql_query("select *from user where userid='".$rowf[userid]."'");
     $rowf3=mysql_fetch_array($rert32);
	     $com="";
	    $rert34=mysql_query("select * from reply where talkid='".$rowf['id']."'  order by id desc limit $de,$size ");
 while($rowf4=mysql_fetch_array($rert34)){
          $rert35=mysql_query("select *from user where userid='".$rowf4[userid]."'");
     $rowf5=mysql_fetch_array($rert35);
 
 $com.="<p class='evaluate'>".$rowf5[niname]."：<span>".$rowf4[content]."<strong>".$rowf4[addtime]."</strong></span></p>";
                  
                            }




   
		$prize[] = new MyPrizeBean($rowf3['images'],$rowf3['niname'],$rowf['addtime'],$rowf['content'],$rowf['id'],$com);
		

}
echo json_encode($prize);


?>